{include file="public/head" /}
{if input('temp_type') eq 'email' or $rs.temp_type eq 'email'}
    {include file="public/js_ueditor" /}
{/if}
<!--有理想的地方，地狱都是天堂-->
<!--Copyright @ df81.com 版权所有-->
<!--作者: 南国老符 邮箱：1062129401@qq.com-->
        <!-- 左侧菜单 开始 -->
        <div class="sidebar">
            <nav>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_content" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_data" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_global" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_system" /}
                </ul>
            </nav>
        </div>
        <!-- 左侧菜单 结束 -->
    </aside>
    <!-- 左侧 结束 -->
    <!-- 右侧 开始 -->
    <div class="content-wrapper">
        <!-- 内容导航 开始 -->
        <div class="content-header py-2 bg-white mb-3">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-12">
                        <ol class="breadcrumb">
                            <li>{:lang('g_system')} {:lang('v_setting')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{:lang('g_system')} {:lang('v_setting')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{:lang('v_sms')} {:lang('v_email')} {:lang('v_template')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{empty name="rs.id"}{:lang('v_add')}{else /}{:lang('v_edit')}{/empty} {:lang('v_template')}</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
        <!-- 内容导航 结束 -->
        <!-- 内容主体 开始 -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="w-100 pt-3 pb-2 bg-white rounded mb-3">
                            <form name="form_keyword" action="{:url('/send_template/index',['lang'=>$lang,'signid'=>1])}" method="post" class="row">
                                <input type="hidden" name="lang" value="{$lang}">
                                <div class="col-md-8">
                                    <a class="btn btn-{if input('temp_type') eq 'email' or $rs.temp_type eq 'email'}success{else /}default{/if} mb-2 mr-2" href="{:url('/send_template/index',['lang'=>$lang,'signid'=>1,'temp_type'=>'email'])}"><i class="fa fa-envelope mr-1"></i>{:lang('v_email')} {:lang('v_template')}</a>
                                    <a class="btn {if input('temp_type') eq 'sms' or $rs.temp_type eq 'sms'}btn-success{else /}btn-default{/if} mb-2 mr-2" href="{:url('/send_template/index',['lang'=>$lang,'signid'=>1,'temp_type'=>'sms'])}"><i class="fa fa-fw fa-mobile-alt mr-1"></i>{:lang('v_sms')} {:lang('v_template')}</a>
                                    {if config('app.other.system_type') neq 'company'}
                                        <a class="btn mb-2 mr-2 btn-default" href="{:url('/send_template/index',['lang'=>$lang,'signid'=>9])}"><i class="fa fa-fw fa-recycle mr-1"></i>{:lang('v_recycle')}</a>
                                        <a class="btn btn-success mb-2 mr-2" href="{:url('/send_template/edit',['lang'=>$lang])}"><i class="fa fa-plus-circle mr-1"></i> {:lang('v_add')} {:lang('v_template')}</a>
                                    {/if}
                                </div>
                                <div class="col-md-4">
                                    <div class="input-group">
                                        <input name="keyword" placeholder="{:lang('v_quickfind')}" type="text" class="form-control">
                                        <span class="input-group-append">
                                            <button type="submit" class="btn btn-success"><i class="fa fa-search mr-1"></i>{:lang('v_search')}</button>
                                        </span>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="card card-outline card-success">
                            <div class="card-header"><i class="fas fa-fw fa-edit mr-1"></i>{empty name="rs.id"}{:lang('v_add')}{else /}{:lang('v_edit')}{/empty} {:lang('v_template')}</div>
                            <div class="card-body">
                                <form name="form_edit" id="form_edit" method="post" action="{:url('/send_template/edit',['lang'=>$lang])}">
                                    <input type="hidden" name="id" value="{$rs.id}">
                                    <input type="hidden" name="lang" value="{$lang}">
                                    <div class="row form-group {if config('app.other.system_type') eq 'company'}d-none{/if}">
                                        <div class="col-md-3 text-right">{:lang('v_type')}</div>
                                        <div class="col-md-9">
                                            <label class="form-check form-check-inline {if !empty($rs.id) and $rs.temp_type neq 'email'}d-none{/if}">
                                                <input type="radio" name="temp_type" id="email" value="email"{if $rs.temp_type eq 'email' or $rs.temp_type eq ''} checked="checked"{/if} class="form-check-input" /> {:lang('v_email')} {:lang('v_template')}
                                            </label>
                                            <label class="form-check form-check-inline {if !empty($rs.id) and $rs.temp_type neq 'sms'}d-none{/if}">
                                                <input type="radio" name="temp_type" id="sms" value="sms"{eq name="rs.temp_type" value="sms"} checked="checked"{/eq} class="form-check-input" /> {:lang('v_sms')} {:lang('v_template')}
                                            </label>
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_template')} {:lang('v_name')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="title" value="{$rs.title}" {if config('app.other.system_type') eq 'company'}readonly="yes"{/if} />
                                        </div>
                                    </div>
                                    <div class="row form-group {if config('app.other.system_type') eq 'company'}d-none{/if}">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_active')} {:lang('v_time')}</div>
                                        <div class="col-md-4">
                                            <div class="input-group">
                                                <input type="text" class="form-control" name="active_time" id="active_time" value="{$rs.active_time}" />
                                                <span class="input-group-append">
                                                    <button type="button" class="btn px-3 btn-default">{:lang('v_minute')}</button>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row form-group {if empty($rs.id) or $rs.temp_type eq 'email'}d-none{/if}" id="div_tempid">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_template')} ID</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="tempid" value="{$rs.tempid}" />
                                        </div>
                                    </div>
                                    <div class="row form-group {if $rs.temp_type eq 'sms'}d-none{/if}" id="div_temp_title">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_email')} {:lang('v_title')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="temp_title" value="{$rs.temp_title}" />
                                        </div>
                                    </div>
                                    <div class="row form-group {if $rs.temp_type eq 'sms'}d-none{/if}" id="div_sendname">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_sendname')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="send_name" value="{$rs.send_name}" />
                                        </div>
                                    </div>
                                    <div class="row form-group {if $rs.temp_type eq 'sms'}d-none{/if}" id="div_reply_address">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_reply_mail')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="reply_address" value="{$rs.reply_address}" />
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">
                                            {:lang('v_content_a')}
                                            {if config('app.other.system_type') neq 'company'}
                                                <br><br>
                                                <span id="content_tips" class="text-0">
                                                    {if empty($rs.id) or $rs.temp_type eq 'email'}
                                                        {:lang('v_email_content_tips')}
                                                    {else /}
                                                        {:lang('v_sms_content_tips')}
                                                    {/if}
                                                </span>
                                            {/if}
                                        </div>
                                        <div class="col-md-6">
                                            <textarea name="content" id="content1a" class="img-rounded" style="width:100%; height:200px;">{$rs.content}</textarea>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="offset-md-3 col-md-9 mb-4">
                                            {if is_file(app()->getRootPath().'.env')}
                                                <button type="submit" class="btn btn-success mr-4"><i class="fa fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                                            {else /}
                                                <button type="button" class="do_ajax btn btn-success mr-4" onclick="javascript:do_ajax('#form_edit','.do_ajax','{:url('/send_template/edit',['lang'=>$lang])}','{:url('/send_template/index',['lang'=>$lang,'signid'=>1,'temp_type'=>'email'])}');"><i class="fas fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                                            {/if}
                                            <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);"><i class="fa fa-angle-double-left mr-1"></i>{:lang('v_goback')}</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- 内容主体 结束 -->
    </div>
    <!-- 右侧 结束 -->
{include file="public/foot" /}
{if input('temp_type') eq 'email' or $rs.temp_type eq 'email'}
    {include file="public/js_rich_text_small" /}
{/if}
<script type="text/javascript">
// 模板类型切换
$('input[name="temp_type"]').click(function(){
    if($(this).val() == 'sms'){
        $('#div_tempid').removeClass("d-none");
        $('#div_temp_title').addClass("d-none");
        $('#div_sendname').addClass("d-none");
        $('#div_reply_address').addClass("d-none");
        $('#div_title').addClass("d-none");
        $('#content_tips').html('{:lang('v_sms_content_tips')}');
    }else{
        $('#div_tempid').addClass("d-none");
        $('#div_temp_title').removeClass("d-none");
        $('#div_sendname').removeClass("d-none");
        $('#div_reply_address').removeClass("d-none");
        $('#div_title').removeClass("d-none");
        $('#content_tips').html('{:lang('v_email_content_tips')}');
    }
});
</script>
</body>
</html>